<?php

namespace app\api\controller\merchant;

use think\Config;
use think\Db;

/**
 * 公共
 */
class Publics
{

	/**
	 * 实例对象
	 * @var object
	 */
	protected static $instance;


	protected $limit_nums = 10000;

	/**
	 * 默认配置
	 * @var array
	 */
	protected $config = [
		"prefix" 		=> "fd_",
		"user" 			=> "user",
		"mer"			=> "machine_address",
		"mac"			=> "machine",
	];

	/**
	 * 默认架构方法
	 */
	public function __construct()
	{
	}

	/**
	 * 实例化
	 */
	public static function instance()
	{
		if (is_null(self::$instance)) {
			self::$instance = new static();
		}
		return self::$instance;
	}

	/**
	 * 使用机器编号获取商户信息
	 */
	public function info_mmcode($mcode)
	{
		$ret = [];
		if ($mcode) {
			$where = ["mercode" => $mcode, "status" => 'normal'];
			$ret = Db::name($this->config["user"])->where($where)->find();
		}
		return $ret;
	}
}
